package com.zyzo.demo.appengine.server.security;

import org.restlet.data.ClientInfo;
import org.restlet.security.Enroler;
import org.restlet.security.Role;

public class MyEnroler implements Enroler {

    public final static Role ADMINISTRATOR = new Role("admin", "administrator");
    
    public final static Role ANONYMOUS = new Role("anonymous", "anonymous");


    public void enrole(ClientInfo clientInfo)
    {
        // Gives the role according to a user.
        if ("admin@mail.com".equals(clientInfo.getUser().getIdentifier())) 
        {
            clientInfo.getRoles().add(ADMINISTRATOR);
        }
        else
        	clientInfo.getRoles().add(ANONYMOUS);

    }

}